# #Lagos download script
LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
## Warning in LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path()): LAGOSNE data for this version already exists on the local machine.
## Re-download if neccessary using the 'overwrite` argument.'
#Load in lagos
lagos <- lagosne_load()
## Warning in (function (version = NULL, fpath = NA) : LAGOSNE version unspecified,
## loading version: 1.087.3
#Grab the lake centroid info
lake_centers <- lagos$locus
#Look at the column names
#names(lake_centers)
#Look at the structure
#str(lake_centers)
#View the full dataset
#View(lake_centers %>% slice(1:100))
spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
crs=4326) %>%
st_transform(2163)
#Subset for plotting
subset_spatial <- spatial_lakes %>%
slice(1:100)
subset_baser <- spatial_lakes[1:100,]
#Dynamic mapviewer
mapview(subset_spatial)
states <- us_states()
#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
filter(name == 'Minnesota') %>%
st_transform(2163)
#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]
#Plotting the first 1000 lakes
minnesota_lakes %>%
arrange(-lake_area_ha) %>%
slice(1:1000) %>%
mapview(.,zcol = 'lake_area_ha')
#Subeset to states of interest
new_states <- states %>%
filter(name %in% c('Iowa', 'Illinois')) %>%
st_transform(2163)
#Create map
mapview(new_states)
combined? How does this compare to Minnesota?
There are almost twice as many lakes in MN (29,038 lakes) as in IA and IL combined (16,466 lakes).
#Get IA outline
iowa <- states %>%
filter(name == 'Iowa') %>%
st_transform(2163)
#Prep state data
ia_lakes <- spatial_lakes[iowa,] %>%
mutate(state = 'IA')
mn_lakes <- minnesota_lakes %>%
mutate(state = 'MN')
#Plot it!
ia_lakes %>%
rbind(mn_lakes) %>%
tibble() %>%
ggplot(.,aes(x = lake_area_ha, color = state))+
scale_x_log10()+
geom_histogram()+
labs(x = 'Lake Area (ha)', y = 'Count')+
facet_wrap(~state)
The shape of the distribution is similar between IA and MN (which makes sense as they were both formed by the same glacial processes), but MN has many more lakes in each bin.
by lake area in hectares
#Map lakes using previous code
new_lakes %>%
arrange(-lake_area_ha) %>%
slice(1:1000) %>%
mapview(.,zcol = 'lake_area_ha')
natural lakes vary in size in these three states?
You could use remotely sensed data to find larger lakes and the USGS’s NHD database to find smaller ponds.